package com.example.vpdemo;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;

import java.util.ArrayList;

public class Main5Activity extends AppCompatActivity {

    private RecyclerView rl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main5);

        rl = (RecyclerView) findViewById(R.id.recycleView);

        final ArrayList<String> strings = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            strings.add("the " + i + "ge ");
        }

        MyAdapter adapter = new MyAdapter(Main5Activity.this, strings);

        LinearLayoutManager layoutManager = new LinearLayoutManager(Main5Activity.this);
        rl.setLayoutManager(layoutManager);
        rl.setAdapter(adapter);
        adapter.setOnClick(new MyAdapter.PassPosition() {
            @Override
            public void pass(int position) {
                startActivity(new Intent(Main5Activity.this, MaterialMainActivity.class));
            }
        });
    }
}
